import net.cookiefarmers.seedswap.*
import org.codehaus.groovy.grails.web.servlet.GrailsApplicationAttributes
import org.springframework.context.ApplicationContext
import grails.util.GrailsUtil

class BootStrap {

    def init = { servletContext ->
		switch(GrailsUtil.environment){
			case "development":
					def admin = new net.cookiefarmers.seedswap.User(login:"admin",
						password:"wordpass") //this is a pre-existing account that allows the admin to login
						admin.save()
					if(admin.hasErrors()){
						println admin.errors
					}
					def jdoe = new net.cookiefarmers.seedswap.User(login:"jdoe",
						password:"password") //this is a pre-existing account
						jdoe.save()
					if(jdoe.hasErrors()){
						println jdoe.errors
					}			
				break
			case "production":break}
		}
    def destroy = {
    }
}
